import os


def getFilePath(filename):
    work_dir = os.path.dirname(os.path.abspath(__file__))

    return scanParentFullPath(work_dir, filename)

    # CONF_FILE = os.path.join(work_dir, filename)
    # # print(CONF_FILE)
    # if os.path.isfile(CONF_FILE):
    #     return CONF_FILE
    # else:
    #     work_dir = os.path.dirname(work_dir)
    #     CONF_FILE =os.path.join(work_dir, filename)
    #     if os.path.isfile(CONF_FILE):
    #         return CONF_FILE

def scanParentFullPath(xpath, xfile):
    work_dir = os.path.dirname(xpath)
    filepath = os.path.join(work_dir, xfile)
    if os.path.isfile(filepath):
        return filepath
    else:
        return scanParentFullPath(work_dir, xfile)
